package com.wwt.springboot_vue.service.impl;

import com.wwt.springboot_vue.bean.Category;
import com.wwt.springboot_vue.mapper.CategoryMapper;
import com.wwt.springboot_vue.service.CategoryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class CategoryServiceImpl implements CategoryService {

    @Autowired
    private CategoryMapper categoryMapper;

    @Override
    public List<Category> findAllCategory() {
        return categoryMapper.findAllCategory();
    }

    @Override
    public List<Category> findAllCategoryBylimit(int start, int size) {
        return categoryMapper.findAllCategoryBylimit(start, size);
    }

    @Override
    public Category  getCategoryIdByName(String category_name) {
        return categoryMapper.getCategoryIdByName(category_name);
    }

    @Override
    public void delete(int category_id) {
        categoryMapper.delete(category_id);
    }

    @Override
    public void update(Category category) {
        categoryMapper.update(category);

    }

    @Override
    public void add(Category category) {
        categoryMapper.add(category);
    }

    @Override
    public int count() {
        return categoryMapper.count();
    }

}
